package com.guyu.common.web.config;

import com.guyu.common.web.config.properties.GuyuWebProperties;
import com.guyu.common.web.interceptor.RequestLogInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@AutoConfiguration
public class GuyuWebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private GuyuWebProperties guyuWebProperties;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 全局访问性能拦截
        registry.addInterceptor(new RequestLogInterceptor(guyuWebProperties));
    }

}
